package com.bite.spring.demo.Controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
@RequestMapping("/guesNum")
public class GuessNumController {
    @RequestMapping("/gues")
    public String guesNum(int num) {
        int random = (int)(Math.random() * 100) + 1;
        System.out.println(random);
        while (true) {
            if (num > random) System.out.println("大了");
            else if (num < random) System.out.println("小了");
            else return "猜对了";
        }
    }
}
